<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../ucs.css">
		<link rel="stylesheet" href="../font/iconfont.css">
		<link rel="stylesheet" href="../demo.css">
	</head>
	<body>
	<div id="main"></div>
	<script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
	<script type="text/javascript" src="../../dist/libs/engine.js"></script>
	<script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>
	<script>
		/**
		 * 个人信息：
		 * 		realNameDM:真实姓名
		 * 		idNumDM：身份证号
		 * 		phoneNumDM：手机
		 * 		ownPwdDM：登录密码
		 * 		payPwdDM：支付密码
		 * 		recommendCodeDM：我的推荐码
		 * 	*/
		var realNameDM = new UDM({
			value: '张三'
		});
		var idNumDM = new UDM({
			value: '4423*******6241'
		});
		var phoneNumDM = new UDM({
			value: '18718417732'
		});
		var ownPwdDM = new UDM({
			value:""
		});
		var payPwdDM = new UDM({
			value: "11111"
		});
		var recommendCodeDM = new UDM({
			value: {
				num:'1000323435',
				recomUser:19,
				recomInvest:20
			}
		});
		//个人实名信息
		var realNameInfoDM = new UDM({
			value:{
                AccType:0,
				Mobile:"",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"FinanceMessage",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount11/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
			}
		})

		var loginPwdDM = new UDM({
			label: '<span>*</span>原密码：',
			placeholder:'请输入原密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"密码必须为6-16位字母、数字的组合"
				}
			]
		});
		var newPwdDM = new UDM({
			label: '<span>*</span>新密码：',
			placeholder:'请输入新密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"请输入正确的密码"
				}
			]
		});
		var newPwdDM2 = new UDM({
			label: '<span>*</span>确认新密码：',
			placeholder:'请输入新密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
//						console.log(pswDM.getValue());
						if(v == newPwdDM.getValue()){
							return true;
						}else{
							return false;
						}
					},
					msg:"两次输入密码不一致"
				}
			]
		});
		var phoneCodeDM = new UDM({
			label: '<span>*</span>手机验证码：',
			placeholder:'请输入短信验证码',
			validator:[
				{type:"require",msg:"请输入短信验证码"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"短信验证码错误，请重新输入"
				},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"验证码已过期，请重新获取"
				}
			]
		});

		var oldPwdDM = new UDM({
			label: '<span>*</span>原支付密码：',
			placeholder:'请输入原支付密码',
			validator:[
				{type:"require",msg:"支付密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"请输入正确的支付密码"
				}
			]
		});
		var newPayPwdDM = new UDM({
			label: '<span>*</span>新支付密码：',
			placeholder:'支付密码为 6 位纯数字',
			validator:[
				{type:"require",msg:"支付密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"请输入正确的支付密码"
				}
			]
		});
		var newPayPwdDM2 = new UDM({
			label: '<span>*</span>确认新支付密码：',
			placeholder:'请再次输入新支付密码',
			validator:[
				{type:"require",msg:"支付密码不能为空"},
				{
					type:"fn",
					fn:function(v){
//						console.log(pswDM.getValue());
						if(v == newPayPwdDM.getValue()){
							return true;
						}else{
							return false;
						}
					},
					msg:"两次输入支付密码不一致"
				}
			]
		});
		var phonePayDM = new UDM({
			label: '<span>*</span>手机验证码：',
			placeholder:'请输入短信验证码',
			validator:[
				{type:"require",msg:"请输入短信验证码"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"短信验证码错误，请重新输入"
				},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"验证码已过期，请重新获取"
				}
			]
		});

		var getBtnCode = new UDM({//修改登录密码  获取短信验证码按钮
			id:"msgbtn",
			name:"",
			count:5,
			onClick:function(){
				if(loginPwdDM.validate() && newPwdDM.validate() && newPwdDM2.validate()){
					UEventHub.emit('getcode',getBtnCode);
				}else{

				}
			}
		});
		var getBtnCode2 = new UDM({//修改支付密码  获取短信验证码按钮
			id:"",
			name:"",
			count:5,
			onClick:function(){
				if(oldPwdDM.validate() && newPayPwdDM.validate() && newPayPwdDM2.validate()){
					UEventHub.emit('getcode',getBtnCode2);
				}else{

				}
			}
		});

		var confirmBtnDM = new UDM({
			onClick:function(){
				console.log(realNameDM);
				if(loginPwdDM.validate() && newPwdDM.validate() && newPwdDM2.validate() && phoneCodeDM.validate()){ //校验各数据模型
					console.log('校验通过！')
					return true;
				}else{
					console.log('校验没通过！');
					return false;
				}
			}
		});
		var payBtnDM = new UDM({
			onClick:function(){
				if(oldPwdDM.validate() || newPayPwdDM.validate() || newPayPwdDM2.validate() || phonePayDM.validate()){ //校验各数据模型
					console.log('校验没通过！')
					return false;
				}else{
					console.log('所有校验通过！');
					return true;
				}
			}
		});

		//链接
		var URLDM = new UDM({
			setRealName:"",		//真实姓名 实名认证
			setId:"",		//身份证 实名认证
			findPwd:"../demoFindPwd/index.html",	//支付密码 找回
			bindCard:""		//支付密码 绑卡
		});
		var PageDM = {
			URL:URLDM,
			realName: realNameDM,
			idNum: idNumDM,
			phoneNum: phoneNumDM,
			loginPwd: loginPwdDM,
			newPwd: newPwdDM,
			newPwd2: newPwdDM2,
			phoneCode: phoneCodeDM,
			oldPwd: oldPwdDM,
			newPayPwd: newPayPwdDM,
			newPayPwd2: newPayPwdDM2,
			phonePay: phonePayDM,
			getBtnCode:getBtnCode,
			getBtnCode2:getBtnCode2,
			ownPwd:ownPwdDM,
			payPwd: payPwdDM,
			recommendCode: recommendCodeDM,
			btn: confirmBtnDM,
			payBtn: payBtnDM,
			realNameInfo: realNameInfoDM
		}

		var ajaxFn = function(){
			recommendCodeDM.setValue({
				num:'1000323435',
				recomInvest:20
			});
			/*个人实名信息*/
			var realName = {
                AccType:0,
				Mobile:"155****2132",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"InvestInfo",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount11/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
			};
			realNameInfoDM.setValue(realName);
		};
		UEventHub.on("pageLoad",function(){
			ajaxFn()
		});
	</script>
    <script type="text/javascript" src="../demoUserInfo\index.js"></script></body>
</html>
